<template>
	<view>
		<view class="box" v-if="scoreInfo">
			<view class="top">
				<view class="middle">
					<view class="title">{{ scoreInfo.exam.title }}</view>
					<view class="grade">
						{{ scoreInfo.score }}
						<view class="grade_">分</view>
					</view>
					<view class="list">
						<view class="same">
							学生姓名：
							<view class="name">{{ scoreInfo.student.student_name }}</view>
						</view>
						<view class="line"></view>
						<view class="same">
							班级名次：
							<view class="name">{{ scoreInfo.rank }}</view>
						</view>
						<view class="line"></view>
						<view class="same">
							任课老师：
							<view class="name">{{ scoreInfo.exam.class_course_teacher.course_teacher_name }}</view>
						</view>
						<view class="line"></view>
						<view class="same">
							考试时间：
							<view class="name">{{ scoreInfo.exam.exam_time }}</view>
						</view>
					</view>
					<button class="share" open-type="share">我要分享</button>
					
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			exam_score_id: '',
			scoreInfo: ''
		};
	},
	onLoad(e) {
		this.exam_score_id = e.exam_score_id;
		this.$u.appLogin(() => {
			this.getScoreInfo();
		});
	},
	
	onShareAppMessage(res) {
	    if (res.from === 'button') {// 来自页面内分享按钮
	      console.log(res.target)
	    }
	    return {
	      title: '我的成绩',
	      path: '/pages/test/test?id=123'
	    }
	  },

	onShow() {},

	methods: {
		// 获取考试详情
		getScoreInfo() {
			this.$u
				.httpGet({
					url: 'users/exam/score_info?exam_score_id=1',
					data: {
						exam_score_id: this.exam_score_id
					}
				})
				.then(res => {
					this.scoreInfo = res.result;
				});
		},
		share(){
			uni.share({
			    provider: "weixin",
			    scene: "WXSceneSession",
			    type: 1,
			    summary: "我在使用师专师生管家！",
			    success: function (res) {
			        console.log("success:" + JSON.stringify(res));
			    },
			    fail: function (err) {
			        console.log("fail:" + JSON.stringify(err));
			    }
			});
		}
	}
};
</script>

<style lang="scss" scoped>
.box {
	display: flex;
}
.top {
	height: 250rpx;
	width: 100%;
	background-color: #458efd;
}
.middle {
	/* width: 650rpx; */
	height: 800rpx;
	margin-top: 60rpx;
	margin-left: 40rpx;
	margin-right: 40rpx;
	border-radius: 20rpx;
	text-align: center;
	background-color: #ffffff;
	box-shadow: #fbfbfb 2rpx;
}
.title {
	font-size: 35rpx;
	padding-top: 25rpx;
}
.grade {
	display: flex;
	flex-direction: row;
	padding-top: 30rpx;
	color: #d04e4c;
	font-size: 70rpx;
	justify-content: center;
	align-items: baseline;
}
.grade_ {
	font-size: 24rpx;
}
.list {
	display: flex;
	flex-direction: column;
}

.same {
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	color: #737373;
	padding-top: 40rpx;
	margin-left: 30rpx;
	font-size: 30rpx;
}
.name {
	margin-right: 30rpx;
}
.rank {
}
.teacher {
}
.share {
	margin-top: 110rpx;
	margin-left: 25rpx;
	text-align: center;
	line-height: 80rpx;
	color: #f4fffc;
	width: 605rpx;
	height: 80rpx;
	background-color: #2e84ff;
	border-radius: 50rpx;
}
.line {
	border-bottom: #f6f6f6 1rpx solid;
	margin-top: 20rpx;
	width: 92%;
	margin-left: 25rpx;
}
</style>
